package test.demo;

import com.alibaba.fastjson.JSON;
import tech.waterism.modelbase.PredictBase;
import tech.waterism.modelbase.PredictResult;
import test.demo.gamma.Gamma;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.math3.distribution.GammaDistribution;

/**
 * 流域汇流单位线（瞬时单位线）
 *
 * @author 初京刚
 * @version 1.0
 * @date 2022-4-29
 */

public class IUH extends PredictBase {

    /**
     * 流域基流
     */
    private double Qbasic;

    /**
     * 线性水库出流系数
     */
    private double K;

    /**
     * 线性水库个数
     */
    private double n;

    /**
     * 降水时间
     */
    private Date[] floodTm;

    /**
     * 降水序列长度
     */
    private Integer floodRainRange;

    /**
     * 降水时段长
     */
    private double timeInterval;

    /**
     * 模拟总产流
     */
    private double[] runoffSim;

    /**
     * 流域面积
     */
    private double F;

    /**
     * 时段长
     */
    private int T;

    public IUH(Map<String, String> data) {
        super();
        Qbasic = Double.parseDouble(data.get("Qbasic"));
        floodTm = JSON.parseObject(data.get("dt"), Date[].class);               // input[i].data.dt
        runoffSim = JSON.parseObject(data.get("runoffSim"), double[].class);    // inout[i].data.runoffSim
        K = Double.parseDouble(data.get("K"));
        n = Double.parseDouble(data.get("n"));
        timeInterval = Double.parseDouble(data.get("clen"));                    // index.clen
        floodRainRange = runoffSim.length;
        F = Double.parseDouble(data.get("F"));
        T = Integer.parseInt(data.get("clen"));        // index.clen
    }

    /**
     * 模型计算
     */
    public Map<String, double[]> IUHmodel() {

        // 瞬时单位线
        double[] QSim = IUHLine();

        Map<String, double[]> simulationResult = new HashMap<>();

        simulationResult.put("runoffSim", runoffSim);
        simulationResult.put("QSim", QSim);
        return simulationResult;
    }

    /**
     * 瞬时单位线
     */
    private double[] IUHLine() {
        double[] QSim = new double[floodRainRange];
        double[] iuh = new double[100];
        double CP = F / T / 3.6;

        GammaDistribution distribution = new GammaDistribution(n, K);
        for(int i = 0; i < iuh.length; i++) {
            if(i == 0) {
                iuh[i] = 0;
            } else {
                iuh[i] = distribution.cumulativeProbability(i) - distribution.cumulativeProbability(i - 1);
            }
        }

        double[][] sums = new double[floodRainRange][];
        for(int i = 0; i < floodRainRange; i++) {
            sums[i] = new double[iuh.length];
            for(int j = 0; j < iuh.length; j++) {
                sums[i][j] = runoffSim[i] * CP * iuh[j];
            }
        }

        for(int i = 0; i < floodRainRange; i++) {
            for(int j = 0; j < i + 1; j++) {
                int k = i - j;
                if(k < sums[j].length) {
                    QSim[i] = QSim[i]+sums[j][k];
                }
            }
        }


       /* double denominator;
        double[] w = new double[floodRainRange];
        if (n == 0 || n == 1) {
            denominator = K;
            for (int t = 0; t < floodRainRange; t++) {
                w[t] = 1 / denominator * Math.exp((-1) * t / K);
            }
        } else {
            denominator = K * Gamma.gamma(n);
            for (int t = 0; t < floodRainRange; t++) {
                w[t] = 1 / denominator * Math.exp((-1) * t / K) * Math.pow(t / K, n - 1);
            }
        }

        for (int i = 0; i < floodRainRange; i++) {
            for (int j = 0; j < floodRainRange; j++) {
                if (i + j < floodRainRange) {
                    QSim[j + i] = QSim[j + i] + runoffSim[i] * w[j];
                }
            }
        }*/

        for (int k = 0; k < floodRainRange; k++) {
            QSim[k] += Qbasic;
        }

        return QSim;
    }

    @Override
    public void init() {

    }

    @Override
    public PredictResult predict() {
        PredictResult result = new PredictResult();
        Map<String, double[]> map = IUHmodel();

        result.setQSim(map.get("QSim"));
        return result;
    }

    public static void main(String[] args) {
        String a = "{\"dt\":\"[\\\"2024-06-01 08:00:00\\\",\\\"2024-06-01 14:00:00\\\",\\\"2024-06-01 20:00:00\\\",\\\"2024-06-02 02:00:00\\\",\\\"2024-06-02 08:00:00\\\",\\\"2024-06-02 14:00:00\\\",\\\"2024-06-02 20:00:00\\\",\\\"2024-06-03 02:00:00\\\",\\\"2024-06-03 08:00:00\\\",\\\"2024-06-03 14:00:00\\\",\\\"2024-06-03 20:00:00\\\",\\\"2024-06-04 02:00:00\\\",\\\"2024-06-04 08:00:00\\\",\\\"2024-06-04 14:00:00\\\",\\\"2024-06-04 20:00:00\\\",\\\"2024-06-05 02:00:00\\\",\\\"2024-06-05 08:00:00\\\",\\\"2024-06-05 14:00:00\\\",\\\"2024-06-05 20:00:00\\\",\\\"2024-06-06 02:00:00\\\",\\\"2024-06-06 08:00:00\\\",\\\"2024-06-06 14:00:00\\\",\\\"2024-06-06 20:00:00\\\",\\\"2024-06-07 02:00:00\\\",\\\"2024-06-07 08:00:00\\\",\\\"2024-06-07 14:00:00\\\",\\\"2024-06-07 20:00:00\\\",\\\"2024-06-08 02:00:00\\\",\\\"2024-06-08 08:00:00\\\",\\\"2024-06-08 14:00:00\\\",\\\"2024-06-08 20:00:00\\\",\\\"2024-06-09 02:00:00\\\",\\\"2024-06-09 08:00:00\\\",\\\"2024-06-09 14:00:00\\\",\\\"2024-06-09 20:00:00\\\",\\\"2024-06-10 02:00:00\\\",\\\"2024-06-10 08:00:00\\\",\\\"2024-06-10 14:00:00\\\",\\\"2024-06-10 20:00:00\\\",\\\"2024-06-11 02:00:00\\\",\\\"2024-06-11 08:00:00\\\",\\\"2024-06-11 14:00:00\\\",\\\"2024-06-11 20:00:00\\\",\\\"2024-06-12 02:00:00\\\",\\\"2024-06-12 08:00:00\\\",\\\"2024-06-12 14:00:00\\\",\\\"2024-06-12 20:00:00\\\",\\\"2024-06-13 02:00:00\\\",\\\"2024-06-13 08:00:00\\\",\\\"2024-06-13 14:00:00\\\",\\\"2024-06-13 20:00:00\\\",\\\"2024-06-14 02:00:00\\\",\\\"2024-06-14 08:00:00\\\",\\\"2024-06-14 14:00:00\\\",\\\"2024-06-14 20:00:00\\\",\\\"2024-06-15 02:00:00\\\",\\\"2024-06-15 08:00:00\\\",\\\"2024-06-15 14:00:00\\\",\\\"2024-06-15 20:00:00\\\",\\\"2024-06-16 02:00:00\\\",\\\"2024-06-16 08:00:00\\\",\\\"2024-06-16 14:00:00\\\",\\\"2024-06-16 20:00:00\\\",\\\"2024-06-17 02:00:00\\\",\\\"2024-06-17 08:00:00\\\",\\\"2024-06-17 14:00:00\\\",\\\"2024-06-17 20:00:00\\\",\\\"2024-06-18 02:00:00\\\",\\\"2024-06-18 08:00:00\\\",\\\"2024-06-18 14:00:00\\\",\\\"2024-06-18 20:00:00\\\",\\\"2024-06-19 02:00:00\\\",\\\"2024-06-19 08:00:00\\\",\\\"2024-06-19 14:00:00\\\",\\\"2024-06-19 20:00:00\\\",\\\"2024-06-20 02:00:00\\\",\\\"2024-06-20 08:00:00\\\",\\\"2024-06-20 14:00:00\\\",\\\"2024-06-20 20:00:00\\\",\\\"2024-06-21 02:00:00\\\",\\\"2024-06-21 08:00:00\\\",\\\"2024-06-21 14:00:00\\\",\\\"2024-06-21 20:00:00\\\",\\\"2024-06-22 02:00:00\\\",\\\"2024-06-22 08:00:00\\\",\\\"2024-06-22 14:00:00\\\",\\\"2024-06-22 20:00:00\\\",\\\"2024-06-23 02:00:00\\\",\\\"2024-06-23 08:00:00\\\",\\\"2024-06-23 14:00:00\\\",\\\"2024-06-23 20:00:00\\\",\\\"2024-06-24 02:00:00\\\",\\\"2024-06-24 08:00:00\\\",\\\"2024-06-24 14:00:00\\\",\\\"2024-06-24 20:00:00\\\",\\\"2024-06-25 02:00:00\\\",\\\"2024-06-25 08:00:00\\\",\\\"2024-06-25 14:00:00\\\",\\\"2024-06-25 20:00:00\\\",\\\"2024-06-26 02:00:00\\\",\\\"2024-06-26 08:00:00\\\",\\\"2024-06-26 14:00:00\\\",\\\"2024-06-26 20:00:00\\\",\\\"2024-06-27 02:00:00\\\",\\\"2024-06-27 08:00:00\\\",\\\"2024-06-27 14:00:00\\\",\\\"2024-06-27 20:00:00\\\",\\\"2024-06-28 02:00:00\\\",\\\"2024-06-28 08:00:00\\\",\\\"2024-06-28 14:00:00\\\",\\\"2024-06-28 20:00:00\\\",\\\"2024-06-29 02:00:00\\\",\\\"2024-06-29 08:00:00\\\",\\\"2024-06-29 14:00:00\\\",\\\"2024-06-29 20:00:00\\\",\\\"2024-06-30 02:00:00\\\",\\\"2024-06-30 08:00:00\\\",\\\"2024-06-30 14:00:00\\\",\\\"2024-06-30 20:00:00\\\",\\\"2024-07-01 02:00:00\\\",\\\"2024-07-01 08:00:00\\\",\\\"2024-07-01 14:00:00\\\",\\\"2024-07-01 20:00:00\\\",\\\"2024-07-02 02:00:00\\\",\\\"2024-07-02 08:00:00\\\",\\\"2024-07-02 14:00:00\\\",\\\"2024-07-02 20:00:00\\\",\\\"2024-07-03 02:00:00\\\",\\\"2024-07-03 08:00:00\\\",\\\"2024-07-03 14:00:00\\\",\\\"2024-07-03 20:00:00\\\",\\\"2024-07-04 02:00:00\\\",\\\"2024-07-04 08:00:00\\\",\\\"2024-07-04 14:00:00\\\",\\\"2024-07-04 20:00:00\\\",\\\"2024-07-05 02:00:00\\\",\\\"2024-07-05 08:00:00\\\",\\\"2024-07-05 14:00:00\\\",\\\"2024-07-05 20:00:00\\\",\\\"2024-07-06 02:00:00\\\",\\\"2024-07-06 08:00:00\\\",\\\"2024-07-06 14:00:00\\\",\\\"2024-07-06 20:00:00\\\",\\\"2024-07-07 02:00:00\\\",\\\"2024-07-07 08:00:00\\\",\\\"2024-07-07 14:00:00\\\",\\\"2024-07-07 20:00:00\\\",\\\"2024-07-08 02:00:00\\\",\\\"2024-07-08 08:00:00\\\",\\\"2024-07-08 14:00:00\\\",\\\"2024-07-08 20:00:00\\\",\\\"2024-07-09 02:00:00\\\",\\\"2024-07-09 08:00:00\\\",\\\"2024-07-09 14:00:00\\\",\\\"2024-07-09 20:00:00\\\",\\\"2024-07-10 02:00:00\\\",\\\"2024-07-10 08:00:00\\\",\\\"2024-07-10 14:00:00\\\",\\\"2024-07-10 20:00:00\\\",\\\"2024-07-11 02:00:00\\\",\\\"2024-07-11 08:00:00\\\",\\\"2024-07-11 14:00:00\\\",\\\"2024-07-11 20:00:00\\\",\\\"2024-07-12 02:00:00\\\",\\\"2024-07-12 08:00:00\\\",\\\"2024-07-12 14:00:00\\\",\\\"2024-07-12 20:00:00\\\",\\\"2024-07-13 02:00:00\\\",\\\"2024-07-13 08:00:00\\\",\\\"2024-07-13 14:00:00\\\",\\\"2024-07-13 20:00:00\\\",\\\"2024-07-14 02:00:00\\\",\\\"2024-07-14 08:00:00\\\",\\\"2024-07-14 14:00:00\\\",\\\"2024-07-14 20:00:00\\\",\\\"2024-07-15 02:00:00\\\",\\\"2024-07-15 08:00:00\\\",\\\"2024-07-15 14:00:00\\\",\\\"2024-07-15 20:00:00\\\",\\\"2024-07-16 02:00:00\\\",\\\"2024-07-16 08:00:00\\\",\\\"2024-07-16 14:00:00\\\",\\\"2024-07-16 20:00:00\\\",\\\"2024-07-17 02:00:00\\\",\\\"2024-07-17 08:00:00\\\",\\\"2024-07-17 14:00:00\\\",\\\"2024-07-17 20:00:00\\\",\\\"2024-07-18 02:00:00\\\",\\\"2024-07-18 08:00:00\\\",\\\"2024-07-18 14:00:00\\\",\\\"2024-07-18 20:00:00\\\",\\\"2024-07-19 02:00:00\\\",\\\"2024-07-19 08:00:00\\\",\\\"2024-07-19 14:00:00\\\",\\\"2024-07-19 20:00:00\\\",\\\"2024-07-20 02:00:00\\\",\\\"2024-07-20 08:00:00\\\",\\\"2024-07-20 14:00:00\\\",\\\"2024-07-20 20:00:00\\\",\\\"2024-07-21 02:00:00\\\",\\\"2024-07-21 08:00:00\\\",\\\"2024-07-21 14:00:00\\\",\\\"2024-07-21 20:00:00\\\",\\\"2024-07-22 02:00:00\\\",\\\"2024-07-22 08:00:00\\\",\\\"2024-07-22 14:00:00\\\",\\\"2024-07-22 20:00:00\\\",\\\"2024-07-23 02:00:00\\\",\\\"2024-07-23 08:00:00\\\",\\\"2024-07-23 14:00:00\\\",\\\"2024-07-23 20:00:00\\\",\\\"2024-07-24 02:00:00\\\",\\\"2024-07-24 08:00:00\\\",\\\"2024-07-24 14:00:00\\\",\\\"2024-07-24 20:00:00\\\",\\\"2024-07-25 02:00:00\\\",\\\"2024-07-25 08:00:00\\\",\\\"2024-07-25 14:00:00\\\",\\\"2024-07-25 20:00:00\\\",\\\"2024-07-26 02:00:00\\\",\\\"2024-07-26 08:00:00\\\",\\\"2024-07-26 14:00:00\\\",\\\"2024-07-26 20:00:00\\\",\\\"2024-07-27 02:00:00\\\",\\\"2024-07-27 08:00:00\\\",\\\"2024-07-27 14:00:00\\\",\\\"2024-07-27 20:00:00\\\",\\\"2024-07-28 02:00:00\\\",\\\"2024-07-28 08:00:00\\\",\\\"2024-07-28 14:00:00\\\",\\\"2024-07-28 20:00:00\\\",\\\"2024-07-29 02:00:00\\\",\\\"2024-07-29 08:00:00\\\",\\\"2024-07-29 14:00:00\\\",\\\"2024-07-29 20:00:00\\\",\\\"2024-07-30 02:00:00\\\",\\\"2024-07-30 08:00:00\\\",\\\"2024-07-30 14:00:00\\\",\\\"2024-07-30 20:00:00\\\",\\\"2024-07-31 02:00:00\\\",\\\"2024-07-31 08:00:00\\\",\\\"2024-07-31 14:00:00\\\",\\\"2024-07-31 20:00:00\\\",\\\"2024-08-01 02:00:00\\\",\\\"2024-08-01 08:00:00\\\",\\\"2024-08-01 14:00:00\\\",\\\"2024-08-01 20:00:00\\\",\\\"2024-08-02 02:00:00\\\",\\\"2024-08-02 08:00:00\\\",\\\"2024-08-02 14:00:00\\\",\\\"2024-08-02 20:00:00\\\",\\\"2024-08-03 02:00:00\\\",\\\"2024-08-03 08:00:00\\\",\\\"2024-08-03 14:00:00\\\",\\\"2024-08-03 20:00:00\\\",\\\"2024-08-04 02:00:00\\\",\\\"2024-08-04 08:00:00\\\",\\\"2024-08-04 14:00:00\\\",\\\"2024-08-04 20:00:00\\\",\\\"2024-08-05 02:00:00\\\",\\\"2024-08-05 08:00:00\\\",\\\"2024-08-05 14:00:00\\\",\\\"2024-08-05 20:00:00\\\",\\\"2024-08-06 02:00:00\\\",\\\"2024-08-06 08:00:00\\\",\\\"2024-08-06 14:00:00\\\",\\\"2024-08-06 20:00:00\\\",\\\"2024-08-07 02:00:00\\\",\\\"2024-08-07 08:00:00\\\",\\\"2024-08-07 14:00:00\\\",\\\"2024-08-07 20:00:00\\\",\\\"2024-08-08 02:00:00\\\",\\\"2024-08-08 08:00:00\\\",\\\"2024-08-08 14:00:00\\\",\\\"2024-08-08 20:00:00\\\",\\\"2024-08-09 02:00:00\\\",\\\"2024-08-09 08:00:00\\\",\\\"2024-08-09 14:00:00\\\",\\\"2024-08-09 20:00:00\\\",\\\"2024-08-10 02:00:00\\\",\\\"2024-08-10 08:00:00\\\",\\\"2024-08-10 14:00:00\\\",\\\"2024-08-10 20:00:00\\\",\\\"2024-08-11 02:00:00\\\",\\\"2024-08-11 08:00:00\\\",\\\"2024-08-11 14:00:00\\\",\\\"2024-08-11 20:00:00\\\",\\\"2024-08-12 02:00:00\\\",\\\"2024-08-12 08:00:00\\\",\\\"2024-08-12 14:00:00\\\",\\\"2024-08-12 20:00:00\\\",\\\"2024-08-13 02:00:00\\\",\\\"2024-08-13 08:00:00\\\",\\\"2024-08-13 14:00:00\\\",\\\"2024-08-13 20:00:00\\\",\\\"2024-08-14 02:00:00\\\",\\\"2024-08-14 08:00:00\\\",\\\"2024-08-14 14:00:00\\\",\\\"2024-08-14 20:00:00\\\",\\\"2024-08-15 02:00:00\\\",\\\"2024-08-15 08:00:00\\\",\\\"2024-08-15 14:00:00\\\",\\\"2024-08-15 20:00:00\\\",\\\"2024-08-16 02:00:00\\\",\\\"2024-08-16 08:00:00\\\",\\\"2024-08-16 14:00:00\\\",\\\"2024-08-16 20:00:00\\\",\\\"2024-08-17 02:00:00\\\",\\\"2024-08-17 08:00:00\\\",\\\"2024-08-17 14:00:00\\\",\\\"2024-08-17 20:00:00\\\",\\\"2024-08-18 02:00:00\\\",\\\"2024-08-18 08:00:00\\\",\\\"2024-08-18 14:00:00\\\",\\\"2024-08-18 20:00:00\\\",\\\"2024-08-19 02:00:00\\\",\\\"2024-08-19 08:00:00\\\",\\\"2024-08-19 14:00:00\\\",\\\"2024-08-19 20:00:00\\\",\\\"2024-08-20 02:00:00\\\",\\\"2024-08-20 08:00:00\\\",\\\"2024-08-20 14:00:00\\\",\\\"2024-08-20 20:00:00\\\",\\\"2024-08-21 02:00:00\\\",\\\"2024-08-21 08:00:00\\\",\\\"2024-08-21 14:00:00\\\",\\\"2024-08-21 20:00:00\\\",\\\"2024-08-22 02:00:00\\\",\\\"2024-08-22 08:00:00\\\",\\\"2024-08-22 14:00:00\\\",\\\"2024-08-22 20:00:00\\\",\\\"2024-08-23 02:00:00\\\",\\\"2024-08-23 08:00:00\\\",\\\"2024-08-23 14:00:00\\\",\\\"2024-08-23 20:00:00\\\",\\\"2024-08-24 02:00:00\\\",\\\"2024-08-24 08:00:00\\\",\\\"2024-08-24 14:00:00\\\",\\\"2024-08-24 20:00:00\\\",\\\"2024-08-25 02:00:00\\\",\\\"2024-08-25 08:00:00\\\",\\\"2024-08-25 14:00:00\\\",\\\"2024-08-25 20:00:00\\\",\\\"2024-08-26 02:00:00\\\",\\\"2024-08-26 08:00:00\\\",\\\"2024-08-26 14:00:00\\\",\\\"2024-08-26 20:00:00\\\",\\\"2024-08-27 02:00:00\\\",\\\"2024-08-27 08:00:00\\\",\\\"2024-08-27 14:00:00\\\",\\\"2024-08-27 20:00:00\\\",\\\"2024-08-28 02:00:00\\\",\\\"2024-08-28 08:00:00\\\",\\\"2024-08-28 14:00:00\\\",\\\"2024-08-28 20:00:00\\\",\\\"2024-08-29 02:00:00\\\",\\\"2024-08-29 08:00:00\\\",\\\"2024-08-29 14:00:00\\\",\\\"2024-08-29 20:00:00\\\",\\\"2024-08-30 02:00:00\\\",\\\"2024-08-30 08:00:00\\\",\\\"2024-08-30 14:00:00\\\",\\\"2024-08-30 20:00:00\\\",\\\"2024-08-31 02:00:00\\\",\\\"2024-08-31 08:00:00\\\",\\\"2024-08-31 14:00:00\\\",\\\"2024-08-31 20:00:00\\\",\\\"2024-09-01 02:00:00\\\",\\\"2024-09-01 08:00:00\\\",\\\"2024-09-01 14:00:00\\\",\\\"2024-09-01 20:00:00\\\",\\\"2024-09-02 02:00:00\\\",\\\"2024-09-02 08:00:00\\\",\\\"2024-09-02 14:00:00\\\",\\\"2024-09-02 20:00:00\\\",\\\"2024-09-03 02:00:00\\\",\\\"2024-09-03 08:00:00\\\",\\\"2024-09-03 14:00:00\\\",\\\"2024-09-03 20:00:00\\\",\\\"2024-09-04 02:00:00\\\",\\\"2024-09-04 08:00:00\\\",\\\"2024-09-04 14:00:00\\\",\\\"2024-09-04 20:00:00\\\",\\\"2024-09-05 02:00:00\\\",\\\"2024-09-05 08:00:00\\\",\\\"2024-09-05 14:00:00\\\",\\\"2024-09-05 20:00:00\\\",\\\"2024-09-06 02:00:00\\\",\\\"2024-09-06 08:00:00\\\",\\\"2024-09-06 14:00:00\\\",\\\"2024-09-06 20:00:00\\\",\\\"2024-09-07 02:00:00\\\",\\\"2024-09-07 08:00:00\\\",\\\"2024-09-07 14:00:00\\\",\\\"2024-09-07 20:00:00\\\",\\\"2024-09-08 02:00:00\\\",\\\"2024-09-08 08:00:00\\\",\\\"2024-09-08 14:00:00\\\",\\\"2024-09-08 20:00:00\\\",\\\"2024-09-09 02:00:00\\\",\\\"2024-09-09 08:00:00\\\",\\\"2024-09-09 14:00:00\\\",\\\"2024-09-09 20:00:00\\\",\\\"2024-09-10 02:00:00\\\",\\\"2024-09-10 08:00:00\\\",\\\"2024-09-10 14:00:00\\\",\\\"2024-09-10 20:00:00\\\",\\\"2024-09-11 02:00:00\\\",\\\"2024-09-11 08:00:00\\\",\\\"2024-09-11 14:00:00\\\",\\\"2024-09-11 20:00:00\\\",\\\"2024-09-12 02:00:00\\\",\\\"2024-09-12 08:00:00\\\",\\\"2024-09-12 14:00:00\\\",\\\"2024-09-12 20:00:00\\\",\\\"2024-09-13 02:00:00\\\",\\\"2024-09-13 08:00:00\\\",\\\"2024-09-13 14:00:00\\\",\\\"2024-09-13 20:00:00\\\",\\\"2024-09-14 02:00:00\\\",\\\"2024-09-14 08:00:00\\\",\\\"2024-09-14 14:00:00\\\",\\\"2024-09-14 20:00:00\\\",\\\"2024-09-15 02:00:00\\\",\\\"2024-09-15 08:00:00\\\",\\\"2024-09-15 14:00:00\\\",\\\"2024-09-15 20:00:00\\\",\\\"2024-09-16 02:00:00\\\",\\\"2024-09-16 08:00:00\\\",\\\"2024-09-16 14:00:00\\\",\\\"2024-09-16 20:00:00\\\",\\\"2024-09-17 02:00:00\\\",\\\"2024-09-17 08:00:00\\\",\\\"2024-09-17 14:00:00\\\",\\\"2024-09-17 20:00:00\\\",\\\"2024-09-18 02:00:00\\\",\\\"2024-09-18 08:00:00\\\",\\\"2024-09-18 14:00:00\\\",\\\"2024-09-18 20:00:00\\\",\\\"2024-09-19 02:00:00\\\",\\\"2024-09-19 08:00:00\\\",\\\"2024-09-19 14:00:00\\\",\\\"2024-09-19 20:00:00\\\",\\\"2024-09-20 02:00:00\\\",\\\"2024-09-20 08:00:00\\\",\\\"2024-09-20 14:00:00\\\",\\\"2024-09-20 20:00:00\\\",\\\"2024-09-21 02:00:00\\\",\\\"2024-09-21 08:00:00\\\",\\\"2024-09-21 14:00:00\\\",\\\"2024-09-21 20:00:00\\\",\\\"2024-09-22 02:00:00\\\",\\\"2024-09-22 08:00:00\\\",\\\"2024-09-22 14:00:00\\\",\\\"2024-09-22 20:00:00\\\",\\\"2024-09-23 02:00:00\\\",\\\"2024-09-23 08:00:00\\\",\\\"2024-09-23 14:00:00\\\",\\\"2024-09-23 20:00:00\\\",\\\"2024-09-24 02:00:00\\\",\\\"2024-09-24 08:00:00\\\",\\\"2024-09-24 14:00:00\\\",\\\"2024-09-24 20:00:00\\\",\\\"2024-09-25 02:00:00\\\",\\\"2024-09-25 08:00:00\\\",\\\"2024-09-25 14:00:00\\\",\\\"2024-09-25 20:00:00\\\",\\\"2024-09-26 02:00:00\\\",\\\"2024-09-26 08:00:00\\\"]\",\"rSim\":\"[[0.0,0.0,0.0,0.0,0.0,7.995484494358607E-4,0.001166226185745245,0.0,0.0,0.0014861482012520355,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0299964247522837,0.012084212287717833,0.0,0.0,0.0038583530575664327,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,2.9798052867135993E-4,0.004871963848700034,0.0,0.0,0.0,0.025240771837488296,0.02847630212059471,0.15991172150934574,0.007633601205185414,0.0,0.0,0.12983349995816695,0.15172055442354093,4.1817331652538314E-4,0.0,0.0,0.0,0.03809901201457677,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.02951815706668981,0.05246449650314844,0.044667857887112916,0.0,0.0,0.09907597058741402,0.09200817690418006,0.4684878199996305,1.1999786647363777,0.5784859634025352,0.005561170670262072,0.21732698928713745,0.0,0.0,0.0,0.05594241588738669,0.020715516311362592,0.0,0.0,0.0,0.0,0.0,0.03153548443992804,0.2511473892681124,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.10930632166439125,0.655884825284609,0.6194125521763709,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.3011571039223284,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.009583238171344988,0.0,0.0,0.0,0.03706307283724186,0.0,0.0,0.8877171709716762,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.24287074109706452,2.4618936434539087,0.4804351661805448,1.8538242443073258,0.0,0.0,0.0,0.0,0.0,0.14178161300272407,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.09713644251764109,0.0,0.0,0.0,0.0,0.0,0.0,0.14301544111809505,0.08998636700389184,0.06657556815892818,0.06694345768042353,0.0,0.06587188042085401,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.39976486274763445,1.4479275793786357,2.128944611054324,1.3451541910542542,17.74808466995802,19.6928951558058,0.049403522585805604,0.0,0.2662211543314889,3.911897107625933,0.0,0.0,1.719649566660826,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.4862908206928891,1.0787222598113106,3.5236315895703703,6.907875301635883,2.644784621430972,0.0,1.8825626356419463,0.5484461965709642,0.0,0.0,0.0,0.1972442835672088,0.6275411544912562,2.2442792897173547,0.0,4.662523440386934,5.312560483420967,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.23177515691539696,3.3495773548723653,2.1607360657086874,0.47950684624043616,0.0,0.2714418193834328,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.17386162222809176,0.0,0.23862871226445215,0.33109730961206907,0.46448245871538596,4.086324417469505,14.232876292901366,4.301245568720972,0.7891955511929751,0.4173620606009649,0.0,0.0,0.0,0.17247609050326118,13.127844587091587,6.995057225930964,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.7782935367322823,2.3436176225300596,0.9780473197183142,16.420454603070965,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.1593558657557956,11.758842999759075,0.25701462677545805,0.0,0.0,0.0,0.0,0.0,0.0,0.7131454377524076,0.29775532422973106,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.3012659950925096,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.2035551749065334,0.4144649994816092,0.0,0.0,0.0,0.0,0.0,0.0]]\",\"rain\":\"[0.0544575,0.0,0.0,0.0543,0.0543,0.5888925,0.6377925,0.0165925,0.0165925,0.7485499999999999,0.25415,0.00185,0.00185,0.0,0.0,0.0,0.0,0.059195,5.727395,1.424695,0.198095,0.154795,0.7665949999999999,0.10749500000000001,0.075595,0.20198,0.13478,0.025179999999999998,0.025179999999999998,0.1662575,0.1579575,1.575E-4,1.575E-4,0.0,0.0,0.0,0.0,0.0011975,0.0011975,0.2482975,0.07789750000000001,0.9904791666975,2.1292625000000003,0.11297916669750001,0.0723791666975,0.10949999999999999,4.316775,2.6194500135000007,7.267024986500001,0.7020725000000001,0.3216725,0.16647250000000002,4.1208725,3.8855342781999997,0.47080857218,0.26600857217999996,0.03600857218,0.1301525,1.2698524999999998,0.0409525,0.018852499999999998,0.0,0.037,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.067514238856,0.124514238856,1.415114238856,2.0052272823799995,1.657840454928,0.053940454927999995,0.053940454927999995,2.94975863732,2.4837285817599994,8.443951469069999,13.862075796800001,5.32197429015,0.5057825,2.1240824999999997,0.3605825,0.0620825,0.215365,0.8878650000000001,0.6185649999999999,0.083465,0.0218725,0.1759725,4.725E-4,4.725E-4,0.714908321,2.412558358,0.1245166666975,6.166666974999999E-4,0.0,0.0,0.0,0.0,0.14688,0.01248,0.0,0.0,0.0039074999999999995,0.0039074999999999995,0.0039074999999999995,0.21742750000000002,0.416080288642,1.4547342357999997,5.87553230561,4.913793274290001,0.0982,0.18209999999999998,0.0,0.0,0.0,0.0,0.0,0.0,0.03012,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0251,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.017219999999999996,0.05722000000000001,0.017219999999999996,0.12821999999999997,0.058359999999999995,4.395700000000001,0.48403999999999997,4.2E-4,0.0,0.0,0.0,0.0,0.0,0.207,0.0251,0.0,0.0029925,0.8397924749999999,0.0029925,0.0029925,0.31592497500000005,1.2977250500000002,9.25E-4,9.25E-4,12.554851417999998,0.36351285727499993,0.12331285727499999,0.031412857275,0.1017,0.0,0.0,0.0,0.0,0.0,0.0,0.0607,0.0251,0.0,0.0,0.0,4.325688784915,23.515201789379994,3.80850260868,10.80461697172,0.2151375,0.1711375,0.11913750000000001,0.0018375000000000002,0.047975,1.43409499592,0.09817500000000001,0.012975,0.00272,0.0,0.0,0.0,0.43520000000000003,1.2639,0.0,0.0,0.0,0.0,0.0,0.0,1.6306280154539998,1.2714341458699998,1.1154669602440002,1.113150879163,0.2018800036,1.1082400008999997,0.0335000009,0.0234600009,0.0214,0.0,0.0,0.0,0.28956353413,3.46876238708,9.3303917772,10.705602318340002,5.911322222969999,30.5412648448,20.38625725258,0.74276561936,0.21647545484,1.138213629,4.90351546844,0.11509545484,0.030599999999100007,3.6308999999991003,0.673979991,0.0395599999991,0.0,0.0543,0.0,0.0,0.0543,0.2355,0.0,0.4002,0.36754142611400015,2.0109601528,3.36255142887,7.505066943699999,7.573264141050001,3.290524137559999,0.46567083395000003,2.70837083395,1.1941857127,0.13017142873,0.17267142873000002,0.36477142873,1.0296125,1.7985225013599995,3.447752537,0.34578249944499995,5.608219973200001,5.9582999995499994,0.37257999955,0.13283999955,0.1987,0.3348,0.1916,0.05062,0.198,0.0479,0.0479,0.15610000000000002,0.06806,0.06806,0.18546,0.09416,0.048362499999999996,0.048362499999999996,4.625E-4,4.625E-4,0.041502954928,0.089402954928,0.152802954928,1.4438011318200001,10.454483320999998,5.4906466697499985,1.5681833533500003,0.38703666765000005,1.1618325,0.21889250000000002,0.1290925,0.09031249999999999,0.025179999999999998,0.05168,0.25020000312,0.012740000000000001,0.0479,0.0,0.0543,0.0,0.0,0.0,0.0,0.0,0.0,0.2296,0.0,0.0543,0.00272,0.0,0.0,0.0,0.003960000135,1.343400000135,0.11537999550000001,1.600320000135,1.9321996944859998,2.38013736833,13.035244701000002,18.8615182215,4.94698508485,1.4349350673220003,1.0631015767299998,0.43243828944,0.2500675,0.2829675,0.9676250000000001,14.595919968799997,7.640796742059999,0.5992428397499999,0.13792990595,0.12664048638,0.0607,0.0,0.0,0.0,0.58709470904,2.47356522336,5.26123477932,1.9566852126,17.0661941192,0.19014052138000004,0.06184263534000001,0.14060263534,0.0543,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.2727,0.0836375,0.0377375,0.054837500000000004,0.0106375,4.5171929532645,21.0550999589,0.9027541429045002,0.17709294426450004,0.074,0.0,0.0,0.0,0.208864241356,2.297764245096,1.18643728238,0.29288423885599996,0.25680000000000003,0.11684,0.0,0.0,0.0,0.0,0.0,0.019,0.0113875,0.0656875,0.0113875,1.4343074999999998,0.3284,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.01004,0.0794,0.0,0.0,0.0,0.0,0.0,0.0,0.0153475,0.0013874999999999998,0.0492875,0.0013874999999999998,0.0,0.0,0.0,0.0543,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.01004,0.01004,0.0,0.01004,0.01004,0.0,0.0,0.0,0.01004,0.0,0.0,0.0,0.0,0.0543,0.0,0.0,0.0,0.0,0.0,0.015,0.1545,0.0,0.01004,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0543,0.0,0.0,0.0,0.0214,0.0214,0.0,0.0,0.0214,0.0,0.0,0.0,2.9286334503560005,4.880777005980001,0.29380608485599996,0.23059345035599998,0.03012,0.0,0.0,0.01276]\",\"q\":\"[]\",\"runoffSim\":\"[0.0,0.0,0.0,0.0,0.0,7.995484494358607E-4,0.001166226185745245,0.0,0.0,0.0014861482012520355,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0299964247522837,0.012084212287717833,0.0,0.0,0.0038583530575664327,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,2.9798052867135993E-4,0.004871963848700034,0.0,0.0,0.0,0.025240771837488296,0.02847630212059471,0.15991172150934574,0.007633601205185414,0.0,0.0,0.12983349995816695,0.15172055442354093,4.1817331652538314E-4,0.0,0.0,0.0,0.03809901201457677,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.02951815706668981,0.05246449650314844,0.044667857887112916,0.0,0.0,0.09907597058741402,0.09200817690418006,0.4684878199996305,1.1999786647363777,0.5784859634025352,0.005561170670262072,0.21732698928713745,0.0,0.0,0.0,0.05594241588738669,0.020715516311362592,0.0,0.0,0.0,0.0,0.0,0.03153548443992804,0.2511473892681124,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.10930632166439125,0.655884825284609,0.6194125521763709,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.3011571039223284,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.009583238171344988,0.0,0.0,0.0,0.03706307283724186,0.0,0.0,0.8877171709716762,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.24287074109706452,2.4618936434539087,0.4804351661805448,1.8538242443073258,0.0,0.0,0.0,0.0,0.0,0.14178161300272407,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.09713644251764109,0.0,0.0,0.0,0.0,0.0,0.0,0.14301544111809505,0.08998636700389184,0.06657556815892818,0.06694345768042353,0.0,0.06587188042085401,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.39976486274763445,1.4479275793786357,2.128944611054324,1.3451541910542542,17.74808466995802,19.6928951558058,0.049403522585805604,0.0,0.2662211543314889,3.911897107625933,0.0,0.0,1.719649566660826,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.4862908206928891,1.0787222598113106,3.5236315895703703,6.907875301635883,2.644784621430972,0.0,1.8825626356419463,0.5484461965709642,0.0,0.0,0.0,0.1972442835672088,0.6275411544912562,2.2442792897173547,0.0,4.662523440386934,5.312560483420967,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.23177515691539696,3.3495773548723653,2.1607360657086874,0.47950684624043616,0.0,0.2714418193834328,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.17386162222809176,0.0,0.23862871226445215,0.33109730961206907,0.46448245871538596,4.086324417469505,14.232876292901366,4.301245568720972,0.7891955511929751,0.4173620606009649,0.0,0.0,0.0,0.17247609050326118,13.127844587091587,6.995057225930964,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.7782935367322823,2.3436176225300596,0.9780473197183142,16.420454603070965,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.1593558657557956,11.758842999759075,0.25701462677545805,0.0,0.0,0.0,0.0,0.0,0.0,0.7131454377524076,0.29775532422973106,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.3012659950925096,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.2035551749065334,0.4144649994816092,0.0,0.0,0.0,0.0,0.0,0.0]\",\"Qbasic\":\"0.0\",\"start\":\"\\\"2024-06-01 08:00:00\\\"\",\"K\":\"0.016\",\"clen\":\"6\",\"n\":\"61.839\"}";
        Map data = JSON.parseObject(a, Map.class);
        IUH obj = new IUH(data);
        System.out.println(obj.predict());
    }
}